home *** CD-ROM | disk | FTP | other *** search
- Path: nntp.teleport.com!usenet
- From: Scott Kinard <kinards@teleport.com>
- Newsgroups: comp.lang.c,comp.lang.perl
- Subject: Random File Access - I don't get it
- Date: Mon, 01 Apr 1996 23:58:22 -0800
- Organization: Teleport - Portland's Public Access (503) 220-1016
- Message-ID: <3160DE1E.495C@teleport.com>
- NNTP-Posting-Host: ip-vanc1-22.teleport.com
- Mime-Version: 1.0
- Content-Type: text/plain; charset=us-ascii
- Content-Transfer-Encoding: 7bit
- X-Mailer: Mozilla 2.01 (Win16; I)
-
- Greetings,
-
- As I was coding a simple program to randomly read lines from a text file it occurred
- to me something was amiss. This is probably some fundamental oversight on my part, but
- some illumination would be helpful...
-
- Suppose I have two files, one contains text (1 line of random length text per
- 'record') and another which is my index into the text file, which contains the starting
- and ending byte positions in the text file for each 'record'. Now the question..
-
- Suppose the text file has 2,000,000 entries. Now, what's the difference in reading
- 1,000,000 lines from the index file to find the starting and ending byte positions in
- the text file for record 1,000,000, and then seeking these in the text file, rather than
- just reading 1,000,000 times from the text file to get the same 'record' in the first
- place?
-
- -Scott
-